/*
 * @Author: WangGuojian 1085844536@qq.com
 * @Date: 2023-04-13 23:31:53
 * @LastEditTime: 2023-04-15 13:11:50
 * @LastEditors: WangGuojian 1085844536@qq.com
 * @FilePath: \guigu-oa\vue-admin-template-master\src\api\system\sysRole.js
 * @Description:
 */
import request from "@/utils/request";

const api_name = "/admin/system/sysRole";

export default {
    // 角色列表-条件分页查询
    getPageList(current, limit, searchObj) {
        return request({
            url: `${api_name}/${current}/${limit}`,
            method: "get",
            // 如果普通对象参数 params: 对象参数名称
            // 如果使用 json 格式传递，data: 对象名称
            params: searchObj,
        });
    },

    // 角色列表-条件分页查询
    removeById(id) {
        return request({
            url: `${api_name}/remove/${id}`,
            method: "delete",
        });
    },

    // 角色添加
    saveRole(role) {
        return request({
            url: `${api_name}/save`,
            method: "post",
            data: role,
        });
    },

    // 根据 id 查询
    getById(id) {
        return request({
            url: `${api_name}/get/${id}`,
            method: "get",
        });
    },

    // 修改
    updateById(role) {
        return request({
            url: `${api_name}/update`,
            method: "put",
            data: role,
        });
    },

    // 批量删除
    batchRemove(idList) {
        return request({
            url: `${api_name}/batchRemove`,
            method: "delete",
            data: idList,
        });
    },
    getRoles(adminId) {
        return request({
            url: `${api_name}/toAssign/${adminId}`,
            method: "get",
        });
    },

    assignRoles(assignRoleVo) {
        return request({
            url: `${api_name}/doAssign`,
            method: "post",
            data: assignRoleVo,
        });
    },
};
